<?php
/**
 * 这个是楼盘相册
 */
    global $_GPC, $_W;
    $uniacid = $this->_uniacid;          
    $uid = $_W['member']['uid']; 
    $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
    
    $newhouse_id = intval($_GPC['newhouse_id']);
    $ftype = 11;
    if(isset($_GPC['ftype']) && $_GPC['ftype']>0){
        $ftype = intval($_GPC['ftype']);
    }
    /*获取浏览人*/
    if($operation =='visitUser'){
        $sql = "select jsondata from ".  tablename("kbwdl_favorite"). " where houseid ='$newhouse_id' and uniacid='$uniacid' and ftype='$ftype'  and openid<>'' order by last_time desc limit 14 ";
        //$moresql = "select avatar from ".  tablename("kbwdl_broker")." where ecuid in ($sql) and avatar<>'' and uniacid='$uniacid' order by id desc limit 14";
        $ret = pdo_fetchall($sql);
        $thumb = array();
        if($ret){
            foreach($ret as $a){                
                if(!empty($a['jsondata'])){
                    $jsondata = json_decode($a['jsondata'], true);
                    if(isset($jsondata['avatar']) && !empty($jsondata['avatar'])){
                        $thumb[] = toimage($jsondata['avatar']);
                    }else{
                        $thumb[] = tomedia( "./addons/kbwdl_shequzufang/style/images/house_face.jpg" )  ;
                    } 
                }
            }
        }
        $thumb = array_reverse($thumb);
        $this->result(0, 'success' , $thumb );
    }
    
    $ret = pdo_fetchall("select * from ".  tablename("kbwdl_house_attach"). " where newhouse_id ='$newhouse_id' and uniacid='$uniacid'");
    $images = array();
    foreach ($ret as $key => $val){
        $images[] = toimage($val['img_url']);
    }
   
    $this->result(0, 'success', $images );
    
?>
